﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="gooddetail.aspx.cs" Inherits="gooddetail" EnableViewState="false" %>
<!DOCTYPE html>
<html>
<head>
    <title>商品详情</title>
</head>
<body>
    <div>
        <section data-role="page" data-theme="b" id="gooddetail_main">
            <div style="padding:20px 10px;" id="gooddetail_content">
                <div class="detail-main">
                    <div class="detail_row">
                	    <!--left-->
                        <div class="row_item row_item-left">
                            <img src="images/goods/album-bb.jpg"  onerror="javascript:this.src='../images/Gift/nogift.jpg'" runat="server" id="gooddetail_MicroGoodsPicture"  style="border-radius:8px;" />
                        </div>
                        <!--right-->
                        <div class="row_item row_item-right">
                            <strong style="font-size:14px;" id="gooddetailMicroGoodsName" runat="server"></strong>
                            <p>市场价：<span class="marketPrice" id="gooddetailMicroSalePrice" runat="server"></span></p>
                            <p>会员价：&nbsp;&nbsp;<span class="discountPrice" id="gooddetailMicroPrice" runat="server"></span></p>
                            <div>
                                <span>购买数量：</span>
                                <span class="minus" id="minus" style="position:relative;top:3px;"><img src="images/minus.png" /></span>
                                <span class="number" id="number">1</span>
                                <span class="plus" id="plus" style="position:relative;top:3px;"><img src="images/plus.png" /></span>
                            </div>
                        </div>
                        <!--right end-->
                    </div>
                </div>
                
                <a data-role="button" data-theme="b" id="goodcard" style="background:#09f;border-radius:8px;margin:0px 3px;border:0px;">加入购物车</a>
               
                 <a href="#goodscard" data-load="goodscard.aspx" data-role="button" data-theme="b" style="display:none;" id="go">前去购物车</a>
                <a href="#goodlist" data-load="goodlist.aspx" data-role="button" data-theme="b" style="display:none;" id="goBack">返回商品列表页</a>
               
                 <input type="hidden" runat="server" id="txtGoodID" />
                 <!--
                <div class="goodsDesc">
                    <p runat="server" id="gooddetail_MicroGoodsRemark" style="line-height:1.6;text-indent:2em;"></p>
                </div>
                      -->
            </div>
        
            <script type="text/javascript">
                $("#minus,#plus").click(function () {
                    var type = $(this).attr("id");
                    var number = parseInt($("#number").text());
                    if (type == "plus") { number++; } else { number <= 1 ? 1 : number--; }
                    $("#number").text(number);
                })

                $("#goodcard").click(function () {
                    var strKey = "";
                    var txtGoodID = $("#txtGoodID");
                    var getData = "";
                    for (var i = 0; i < localStorage.length; i++) {
                        strKey = localStorage.key(i);
                        if (strKey.substring(0, 5) == "good_") {
                            getData = JSON.parse(xxl.xd.getValue(strKey));
                            if (getData.MicroGoodsID == txtGoodID.val()) { break; } else { getData = ""; }
                        }
                    }
                    if (getData == "") {//新增
                        var goodlist = new Object();
                        goodlist.Type = "good_" + retRndNum(3);
                        goodlist.MicroGoodsID = txtGoodID.val();
                        goodlist.ConvertNumber = $("#number").text();
                        xxl.xd.setValue(goodlist.Type, JSON.stringify(goodlist));
                    } else { //编辑
                        getData.ConvertNumber = parseInt(getData.ConvertNumber) + parseInt($("#number").text());
                        xxl.xd.setValue(getData.Type, JSON.stringify(getData));
                    }
                    var cookieStr = "";
                    for (var i = 0; i < localStorage.length; i++) {
                        strKey = localStorage.key(i);
                        if (strKey.substring(0, 5) == "good_") {
                            getData = JSON.parse(xxl.xd.getValue(strKey));
                            cookieStr += getData.MicroGoodsID + ',' + getData.ConvertNumber + '|';
                        }
                    }
                    setCookie("goodlist", cookieStr);
                    var result = confirm("添加成功,是否进行结算？");
                    if (result) { $("#go").click(); } else { $("#goBack").click(); }
                })
            </script>

            <footer data-role="footer" data-position="fixed" id="gooddetail_footer">
                <div data-role="navbar" id="nav-glyphish-example">
                    <ul>
                        <li><a href="#index" id="A1"><img src="images/business_site_btn.png" /><br/>商家网站</a></li>
                        <li class="footer_active"><a href="#goodlist" id="A2" data-load="goodlist.aspx"><img src="images/02.png" /><br/>商品购买</a></li>
                        <li><a href="#membershipcard" data-load="membershipcard.aspx" id="A3"><img src="images/member_card_btn.png" /><br/>会员卡</a></li>
                        <li><a href="#giftlist" data-load="giftlist.aspx" id="A4" class="ui-btn-active"><img src="images/exchange_btn.png" /><br/>积分兑换</a></li>
                    </ul>
                </div>
            </footer>

           
        </section>
    </div>
</body>
</html>

